#ifdef KITSCHY_DEBUG_MEMORY 
#include "debug_memorymanager.h"
#endif

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "math.h"


#include "BList.h"
#include "BVector.h"
#include "geometrics.h"
#include "quaternion.h"
#include "symbol.h"
#include "sort.h"
#include "ontology.h"
#include "featureterm.h"
#include "FTKBase.h"

#include "AWLocalViewport.h"

#include "AWEntity.h"
#include "AWMessage.h"
#include "AWScenario.h"
#include "AWBody.h"
#include "AWSensor.h"
#include "AWBrain.h"
#include "AWAgent.h"
#include "AWWorld.h"


AW_Sensor::AW_Sensor(Ontology *O,FTKBase *M) : AW_Entity() 
{
	class_name->set("AW_Sensor");
	m_ontology=O;
	m_memory=M;
} /* AW_Sensor */ 


AW_Sensor::AW_Sensor(FILE *fp,Ontology *O,FTKBase *M)
{
	class_name->set("AW_Sensor");
	m_ontology=O;
	m_memory=M;
	load(fp);
} /* AW_Sensor */ 


bool AW_Sensor::load(FILE *fp)
{
	if (!AW_Entity::load(fp)) return false;

	return true;
} /* AW_Sensor::load */ 


bool AW_Sensor::save(FILE *fp)
{
	if (!AW_Entity::save(fp)) return false;

	return true;
} /* AW_Sensor::save */ 


List<AW_Message> *AW_Sensor::ObtainMsg(void)
{
	List<AW_Message> *l;

	l=new List<AW_Message>;
	l->Instance(message_queue);

	return l;
} /* AW_Sensor::ObtainMsg */ 


void AW_Sensor::clear_msg(void) 
{
	message_queue.Delete();
} /* AW_Sensor::clear_msg */ 


List<FeatureTerm> *AW_Sensor::sense(AW_Agent *,AW_World *)
{
	return 0;
} /* AW_Sensor::sense */ 


bool AW_Sensor::is_a(char *c)
{
	if (strcmp(c,"AW_Sensor")==0) return true;

	return AW_Entity::is_a(c);
} /* AW_Sensor::is_a */ 


bool AW_Sensor::is_a(Symbol *c)
{
	if (c->cmp("AW_Sensor")) return true;

	return AW_Entity::is_a(c);
} /* AW_Sensor::is_a */ 


void AW_Sensor::receive_msg(AW_Message *m) 
{
//	write_debug_report("AW_Sensor [%s]: message received from %s\n",m->receiver->get(),m->sender->get());
	message_queue.Add(m);
} /* AW_Sensor::receive_msg */ 
